<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>修改信息</title>
</head>
<body>
    <div style="margin-left: 50%">
        <form id="form-edit" th:action="@{/editInfo}" method="post">
            <input type="hidden" name="id" th:value="${session.user.id}">
            <div>
                用户名：<input id="username" name="username" type="text" th:value="${session.user.username}">
            </div>
            <div>
                修改密码：<input id="password" name="password" type="password" th:value="${session.user.password}">
            </div>
            <div>
                确认密码：<input id="rePassword" name="rePassword" type="password" th:value="${session.user.password}">
            </div>
            <div>
                <input type="submit" class="button" value="保存">
            </div>
        </form>
    </div>
    <div th:include="common :: common"></div>
</body>
</html>
<script>
    $(function () {
        $("#form-edit").validate({
            submitHandler: function(form){
                form.submit();   //提交表单
            },
            rules:{
                username:{
                    required: true
                },
                password:{
                    required: true
                },
                rePassword:{
                    required: true,
                    equalTo: "#password"
                }
            },
            focusCleanup: true
        });
    });
</script>